package com.bbva.cbm.web.servlet.spring.operatoria;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;

import cbm.commons.BaseController;
import ejb.com.bbva.cbm.service.OperativaServiceLocal;


public class ConsultaSaldoFinalController  extends BaseController {

	public OperativaServiceLocal operativaServiceLocal;

	@Autowired
	public void setOperativaServiceLocal(OperativaServiceLocal operativaServiceLocal) {
		this.operativaServiceLocal = operativaServiceLocal;
	}

	public ModelAndView actualizarEstadoImpresion(HttpServletRequest request, HttpServletResponse response){
		return null;
	}
	
	public ModelAndView open(HttpServletRequest request, HttpServletResponse response){
		String paginaSig = resources.getString("consaldo_final");
		
		try {
			String oficinaId  = getOficinaId(request);
			request.setAttribute("porce",(1.0/(getCache(request).getDivisas().size()*1.0))*100+"%");
			request.setAttribute("datos", operativaServiceLocal.obtenerDatosConsultaSaldosFinales(oficinaId));
		} catch (Exception e) {
			e.printStackTrace();logger.error(e);
		}
		
		return new ModelAndView(paginaSig);
	}
}